Skip to content

Add Azure Key Vault certificate version option - #1074

Merged
dtivel merged 6 commits into
mainfrom
dtivel/key-vault-certificate-version
Sep 18, 2026
Merged

dtivel merged 6 commits into
mainfrom
dtivel/key-vault-certificate-version

Conversation

@dtivel

@dtivel dtivel commented Sep 15, 2026

Copy link
Copy Markdown
Collaborator

Adds --azure-key-vault-certificate-version / -kvcv to select a specific Azure Key Vault certificate version.

The implementation:

  • Validates versions using the publicly documented 32-character format.
  • Retrieves the requested certificate version without falling back to latest.
  • Uses the certificate's authoritative backing KeyId, since certificate and key versions can differ.
  • Validates and normalizes missing or malformed backing key identifiers.
  • Caches the selected certificate and cryptography client.

Based on #1046 by @Guflly, preserving the original commit authorship.

Resolves #1005

Testing

  • Full test suite: 813 passed, 1 skipped.
  • Focused certificate-version and invalid-KeyId tests: 16 passed.
  • Baseline/candidate release matrix: 12 signing scenarios passed across NuGet, ClickOnce, and VSTO using local certificates and Azure Key Vault.
  • Verified explicit current-version signing and rejection of invalid-length values.

Guflly and others added 5 commits September 14, 2026 16:13
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 06da229d-3449-4299-9aa3-c24073ffd97a
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 06da229d-3449-4299-9aa3-c24073ffd97a
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 06da229d-3449-4299-9aa3-c24073ffd97a
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 06da229d-3449-4299-9aa3-c24073ffd97a
@dtivel
dtivel requested a review from a team as a code owner September 15, 2026 17:19
@dtivel
dtivel requested review from kartheekp-ms and a balanced review from Copilot September 15, 2026 17:26

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟢 Approval recommended

The version is correctly propagated, retrieval avoids fallback, backing key IDs are validated, and focused tests cover the behavior.

Review tier: Balanced
Findings: None

What changed in this PR

Adds Azure Key Vault certificate-version selection while ensuring signing uses the certificate’s authoritative backing key.

Changes:

  • Adds --azure-key-vault-certificate-version / -kvcv with validation.
  • Retrieves and caches the selected certificate and its versioned cryptography client.
  • Adds localized resources and focused CLI/service tests.
File Description
test/​Sign.SignatureProviders.KeyVault.Test/​KeyVaultServiceTests.cs Tests version retrieval, key-ID validation, and caching.
test/​Sign.SignatureProviders.KeyVault.Test/​KeyVaultServiceProviderTests.cs Updates service construction.
test/​Sign.Cli.Test/​AzureKeyVaultCommandTests.cs Tests option parsing, validation, and DI propagation.
src/​Sign.SignatureProviders.KeyVault/​xlf/​Resources.zh-Hant.xlf Adds key-ID error resource.
src/​Sign.SignatureProviders.KeyVault/​xlf/​Resources.zh-Hans.xlf Adds key-ID error resource.
src/​Sign.SignatureProviders.KeyVault/​xlf/​Resources.tr.xlf Adds key-ID error resource.
src/​Sign.SignatureProviders.KeyVault/​xlf/​Resources.ru.xlf Adds key-ID error resource.
src/​Sign.SignatureProviders.KeyVault/​xlf/​Resources.pt-BR.xlf Adds key-ID error resource.
src/​Sign.SignatureProviders.KeyVault/​xlf/​Resources.pl.xlf Adds key-ID error resource.
src/​Sign.SignatureProviders.KeyVault/​xlf/​Resources.ko.xlf Adds key-ID error resource.
src/​Sign.SignatureProviders.KeyVault/​xlf/​Resources.ja.xlf Adds key-ID error resource.
src/​Sign.SignatureProviders.KeyVault/​xlf/​Resources.it.xlf Adds key-ID error resource.
src/​Sign.SignatureProviders.KeyVault/​xlf/​Resources.fr.xlf Adds key-ID error resource.
src/​Sign.SignatureProviders.KeyVault/​xlf/​Resources.es.xlf Adds key-ID error resource.
src/​Sign.SignatureProviders.KeyVault/​xlf/​Resources.de.xlf Adds key-ID error resource.
src/​Sign.SignatureProviders.KeyVault/​xlf/​Resources.cs.xlf Adds key-ID error resource.
src/​Sign.SignatureProviders.KeyVault/​Resources.resx Defines the key-ID validation message.
src/​Sign.SignatureProviders.KeyVault/​Resources.Designer.cs Exposes the new resource.
src/​Sign.SignatureProviders.KeyVault/​KeyVaultService.cs Retrieves versioned certificates and uses their backing keys.
src/​Sign.Cli/​xlf/​AzureKeyVaultResources.zh-Hant.xlf Adds localized option resources.
src/​Sign.Cli/​xlf/​AzureKeyVaultResources.zh-Hans.xlf Adds localized option resources.
src/​Sign.Cli/​xlf/​AzureKeyVaultResources.tr.xlf Adds localized option resources.
src/​Sign.Cli/​xlf/​AzureKeyVaultResources.ru.xlf Adds localized option resources.
src/​Sign.Cli/​xlf/​AzureKeyVaultResources.pt-BR.xlf Adds localized option resources.
src/​Sign.Cli/​xlf/​AzureKeyVaultResources.pl.xlf Adds localized option resources.
src/​Sign.Cli/​xlf/​AzureKeyVaultResources.ko.xlf Adds localized option resources.
src/​Sign.Cli/​xlf/​AzureKeyVaultResources.ja.xlf Adds localized option resources.
src/​Sign.Cli/​xlf/​AzureKeyVaultResources.it.xlf Adds localized option resources.
src/​Sign.Cli/​xlf/​AzureKeyVaultResources.fr.xlf Adds localized option resources.
src/​Sign.Cli/​xlf/​AzureKeyVaultResources.es.xlf Adds localized option resources.
src/​Sign.Cli/​xlf/​AzureKeyVaultResources.de.xlf Adds localized option resources.
src/​Sign.Cli/​xlf/​AzureKeyVaultResources.cs.xlf Adds localized option resources.
src/​Sign.Cli/​AzureKeyVaultResources.resx Defines option description and validation message.
src/​Sign.Cli/​AzureKeyVaultResources.Designer.cs Exposes the new CLI resources.
src/​Sign.Cli/​AzureKeyVaultCommand.cs Adds, validates, and propagates the version option.
Files not reviewed (2)
  • src/Sign.Cli/AzureKeyVaultResources.Designer.cs: Generated file
  • src/Sign.SignatureProviders.KeyVault/Resources.Designer.cs: Generated file

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

kartheekp-ms
kartheekp-ms previously approved these changes Sep 18, 2026
Comment thread src/Sign.Cli/AzureKeyVaultCommand.cs Resolved
Comment thread src/Sign.Cli/AzureKeyVaultCommand.cs Resolved
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add certificate version option (-kvcv) when using azure-key-vault

4 participants